.consultationChat {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px;
  height: 800px;
  display: flex;
  flex-direction: column;

  .chatCard {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    :global(.ant-card-body) {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 24px;
      background: #f5f5f5;
      overflow: hidden;
      min-height: 0;
    }

    :global(.ant-card-head) {
      flex-shrink: 0;
      background: #fff;
      border-bottom: 1px solid #f0f0f0;
      padding: 0 24px;
      height: 56px;
      line-height: 56px;

      .ant-card-head-title {
        padding: 0;
        
        .anticon {
          margin-right: 8px;
          font-size: 18px;
        }
      }

      .ant-card-extra {
        padding: 0;
        
        .ant-btn {
          margin-left: 8px;

          &.ant-btn-link {
            padding: 0;
            height: auto;
          }
        }
      }
    }
  }

  .messageList {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 0 12px;
    position: relative;
    min-height: 0;

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background-color: rgba(0, 0, 0, 0.2);
      border-radius: 3px;
    }

    &::-webkit-scrollbar-track {
      background-color: transparent;
    }

    .empty {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: #fff;
      padding: 32px;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
      text-align: center;

      :global(.ant-empty-description) {
        color: rgba(0, 0, 0, 0.45);
      }
    }
  }

  .messageItem {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;

    &:last-child {
      margin-bottom: 0;
    }

    .messageWrapper {
      display: flex;
      align-items: flex-start;
      max-width: 80%;
    }

    .avatar {
      flex-shrink: 0;
      margin: 0 12px;
    }

    .nameText {
      font-size: 12px;
      color: rgba(0, 0, 0, 0.45);
      margin-bottom: 4px;
      padding: 0 12px;
    }

    .messageContent {
      flex: 1;
      position: relative;

      .messageText {
        padding: 12px 16px;
        background-color: #fff;
        border-radius: 4px 12px 12px 12px;
        white-space: pre-wrap;
        word-break: break-all;
        font-size: 14px;
        line-height: 1.6;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

        &.typing {
          &::after {
            content: '';
            display: inline-block;
            width: 4px;
            height: 16px;
            background: #1890ff;
            margin-left: 4px;
            vertical-align: middle;
            animation: blink 1s infinite;
          }
        }
      }

      .messageTime {
        font-size: 12px;
        color: rgba(0, 0, 0, 0.45);
        margin-top: 4px;
        text-align: left;
      }
    }

    &.userMessage {
      align-items: flex-end;

      .messageWrapper {
        flex-direction: row-reverse;
      }

      .nameText {
        text-align: right;
      }

      .messageContent {
        .messageText {
          background-color: #95ec69;
          border-radius: 12px 4px 12px 12px;
          color: #000;
        }

        .messageTime {
          text-align: right;
        }
      }
    }

    &.aiMessage {
      align-items: flex-start;

      .messageContent {
        .messageText {
          background-color: #fff;
        }
      }
    }

    &.thinking {
      align-items: flex-start;
      
      .messageContent {
        .messageText {
          color: #1890ff;
          background-color: rgba(24, 144, 255, 0.1);
          padding: 8px 16px;
          font-size: 13px;
          animation: fadeIn 0.3s ease-in-out;
        }
      }
    }
  }

  .inputArea {
    flex-shrink: 0;
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-top: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);

    :global(.ant-input) {
      padding-right: 100px;
      border-radius: 4px;
      resize: none;
      font-size: 14px;
      line-height: 1.6;
      background: #fff;

      &:disabled {
        background-color: #f5f5f5;
        cursor: not-allowed;
      }
    }

    :global(.ant-btn) {
      position: absolute;
      bottom: 24px;
      right: 24px;
      height: 32px;
      padding: 0 16px;
      border-radius: 16px;

      .anticon {
        margin-right: 4px;
      }

      &:disabled {
        background-color: #f5f5f5;
        border-color: #d9d9d9;
        color: rgba(0, 0, 0, 0.25);
      }
    }
  }
}

.consultationHistory {
  padding: 24px;

  .searchForm {
    margin-bottom: 24px;
    padding: 24px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    :global(.ant-form-item) {
      margin-bottom: 24px;

      &:last-child {
        margin-bottom: 0;
        margin-right: 0;
      }
    }
  }

  .table {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    :global {
      .ant-table {
        .ant-table-thead > tr > th {
          background: #fafafa;
          font-weight: 500;
        }

        .ant-table-row {
          &:hover {
            .ant-table-cell {
              background: #f5f5f5;
            }
          }
        }
      }

      .ant-table-pagination {
        margin: 16px 24px;
      }
    }
  }

  .detailModal {
    .basicInfo {
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid #f0f0f0;

      .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;

        h3 {
          margin: 0;
          font-size: 16px;
          font-weight: 500;
        }
      }

      .content {
        .item {
          margin-bottom: 8px;
          line-height: 1.5;

          &:last-child {
            margin-bottom: 0;
          }

          :global(.ant-typography-secondary) {
            margin-right: 8px;
          }
        }
      }
    }

    .consultation {
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid #f0f0f0;

      h3 {
        margin-bottom: 16px;
        font-size: 16px;
        font-weight: 500;
      }

      .section {
        margin-bottom: 16px;
        line-height: 1.5;

        &:last-child {
          margin-bottom: 0;
        }

        :global(.ant-typography-secondary) {
          display: block;
          margin-bottom: 4px;
        }
      }
    }

    .messages {
      h3 {
        margin-bottom: 16px;
        font-size: 16px;
        font-weight: 500;
      }

      .message {
        margin-bottom: 16px;
        padding: 12px;
        border-radius: 4px;

        &:last-child {
          margin-bottom: 0;
        }

        &.user {
          background: #e6f7ff;
        }

        &.ai {
          background: #f5f5f5;
        }

        .messageHeader {
          display: flex;
          justify-content: space-between;
          margin-bottom: 8px;
          font-size: 12px;
          color: rgba(0, 0, 0, 0.45);
        }

        .messageContent {
          line-height: 1.6;
          white-space: pre-wrap;
          font-size: 14px;
        }
      }
    }
  }
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
} 